package AfterClass;

public class Homework7 {
	public static void main(String[] args) {
		int[] arr = new int[1000];
		int count = 0;
		for(int i=0; i<1000; i++){
			arr[i] = i+1;
			if((judgePrimeNum(arr[i])) && (judgeHuiwenNum(arr[i]))){
				System.out.print(arr[i]+" ");
				count++;
			}
			if(count==10){
				System.out.println();
				count=0;
			}
		}
		
	}
	
	public static boolean judgePrimeNum(int num1){
		boolean a = true;
		for(int i=2; i<num1; i++){
			if(num1 % i == 0){
				a = false;
				break;
			}
		}
		return a;
	}
	
	public static boolean judgeHuiwenNum(int num2){
		boolean b = false;
		int temp;
		int originalNum = num2;
		int processNum=0;
		while(num2%10 != 0){
			temp = 0;
			temp = num2%10;
			processNum = processNum*10+temp;
			num2 = num2/10;
		}
		if(originalNum == processNum){
			b = true;
		}
		return b;
	}

}
